def now
  Gosu::milliseconds
end

class Fixnum
  def from(time)
    time.ms + self
  end

  def milliseconds
    self
  end
  alias_method :ms, :milliseconds

  def seconds
    self * 1000
  end
  alias_method :second, :seconds

  def since?(time)
    now - time.ms >= self
  end
  
  def yet?
    self <= now
  end
end

class Float
  def milliseconds
    self.floor
  end
  alias_method :ms, :milliseconds
  
  def seconds
    (self * 1000).floor
  end
  alias_method :second, :seconds
end

class NilClass
  def milliseconds
    0
  end
  alias_method :ms, :milliseconds
  alias_method :second, :milliseconds
  alias_method :seconds, :milliseconds
end
